<template>
    <div class="image" :style="{ width: width + 'px', height: width + 'px' }">
      <el-image
        :style="{ width: width + 'px', height: width + 'px' }"
        fit="scale-down"
        loading="lazy"
        :src="image ? proxy.globalInfo.imageUrl + image : localImage"
      >
      </el-image>
    </div>
  </template>
  
  <script setup>
  import { getCurrentInstance } from "vue";
  const { proxy } = getCurrentInstance();
  
  const localImage = new URL("@/assets/default_cover.png", import.meta.url).href;
  
  const props = defineProps({
    image: {
      type: String,
    },
    width: {
      type: Number,
      default: 60,
    },
  });
  </script>
  
  <style lang="scss">
  .image {
    background: #ddd;
    border-radius: 5px;
    overflow: hidden;
  }
  </style>